import { createStore } from 'vuex'
import createPersistedState from 'vuex-persistedstate'
import MenuModule from './modules/menu'
import UserModule from './modules/user'
import CollaborativeApprovalModule from "./modules/collaborativeApproval"
import CommonModule from "./modules/common"

const store =  createStore({
  // 数据源存放地 应用数据的数据结构及初始状态
  plugins: [createPersistedState({
    reducer(val) {
      return {
        // menu:val.menu,
        collaborativeApproval:val.collaborativeApproval,
        user:val.user
      }
    }
  })],
  modules: {
    menu: MenuModule,
    user: UserModule,
    collaborativeApproval:CollaborativeApprovalModule,
    common:CommonModule
  }
})

export default store
